alert('Scene2.js loaded');

var PosDialButton;
var answer = 1;

function SceneScene2() {
	
};

SceneScene2.prototype.initialize = function () {
	alert("SceneScene2.initialize()");
	// this function will be called only once when the scene manager show this scene first time
	// initialize the scene controls and styles, and initialize your variables here
	// scene var CurrentScene="Scene2";HTML and CSS will be loaded before this function is called
	/*
	choice = '1-d';
	
	if(choice=='1-d'){
		compteur = 0;
		scene = '2/2-a.json';
	}else{
		compteur = 0;
		scene = '2/2-b.json';
	}
	*/
	sf.scene.show('ToolBar');

};

SceneScene2.prototype.handleShow = function (data) {
	alert("SceneScene2.handleShow()");
	// this function will be called when the scene manager show this scene
	IdScene ="1";
	CurrentScene = "Scene2";
	VideoId = 0;
	//choice = '1-d';
	SceneReset(CurrentScene,1);
	
	alert(' StartingVideoScene  CurrentScene ='+CurrentScene); 
	//StartingVideoYoutubeScene(CurrentScene);
	//
};

SceneScene2.prototype.handleHide = function () {
	alert("SceneScene2.handleHide()");
	// this function will be called when the scene manager hide this scene
	scene = "";
};

SceneScene2.prototype.handleFocus = function () {
	alert("SceneScene2.handleFocus()");
	// this function will be called when the scene manager focus this scene
};

SceneScene2.prototype.handleBlur = function () {
	alert("SceneScene2.handleBlur()");
	// this function will be called when the scene manager move focus to another scene from this scene
};



SceneScene2.prototype.handleKeyDown = function (keyCode) {
	alert("SceneScene2.handleKeyDown(" + keyCode + ")");
	// TODO : write an key event handler when this scene get focued
	switch (keyCode) {
		case sf.key.LEFT:
			break;
		case sf.key.RIGHT:
			break;
		case sf.key.UP:
			if(AddButton == true){

					
					PosDialButton = (PosDialButton+1)%NbButton;
					FocusCssButton(PosDialButton,-1);

			}
			
			/*$('#button1').hasClass('active')) {
                $('#button1').removeClass('active');
                $('#button2').addClass('active');
            */
			
			break;
		case sf.key.DOWN:
			if(AddButton == true){

				
				PosDialButton = (PosDialButton+1)%NbButton;
				FocusCssButton(PosDialButton,1);

		}

			break;
		case sf.key.ENTER:
			Enter();
			break;
		case sf.key.RETURN:
			event.preventDefault();			
			sf.scene.hide('Scene2');
			sf.scene.show('MapQueensPark');
			sf.scene.focus('MapQueensPark');
			break;
		default:
			alert("handle default key event, key code(" + keyCode + ")");
			break;
	}
};